package com.easyadmin.entity.enums;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @Description: 日志记录操作结果
 * @auther: 多多洛
 * @param:
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum OpResultEnum {
    SUCCESS(200, "成功"), FAIL(500, "失败");

    private int type;
    private String description;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    private OpResultEnum(int type, String description) {
        this.type = type;
        this.description = description;
    }

    public static OpResultEnum getStatusByType(Integer type) {
        for (OpResultEnum at : OpResultEnum.values()) {
            if (at.type == type) {
                return at;
            }
        }
        return null;
    }
}
